package com.whfc.emp.dao;

import com.whfc.emp.dto.AppWarnRuleDTO;
import com.whfc.emp.entity.AppEmpWarnRule;
import org.apache.ibatis.annotations.Param;

import java.util.List;

public interface AppEmpWarnRuleMapper {
    int deleteByPrimaryKey(Integer id);

    int insert(AppEmpWarnRule record);

    int insertSelective(AppEmpWarnRule record);

    AppEmpWarnRule selectByPrimaryKey(Integer id);

    int updateByPrimaryKeySelective(AppEmpWarnRule record);

    int updateByPrimaryKey(AppEmpWarnRule record);


    /**
     * 查询报警类别Id
     *
     * @param ruleType
     * @param deptId
     * @return
     */
    Integer selectByRuleType(@Param("ruleType") Integer ruleType,
                             @Param("deptId") Integer deptId);

    /**
     * 查找所有的报警规则
     *
     * @param deptId
     * @param warnType
     * @return
     */
    List<AppWarnRuleDTO> selectRulesByDeptId(@Param("deptId") Integer deptId,
                                             @Param("warnType") Integer warnType);

    /**
     * 批量添加
     *
     * @param list
     */
    void batchInsert(@Param("list") List<AppEmpWarnRule> list);

    /**
     * 启用/禁用报警规则
     *
     * @param ruleId
     * @param enableFlag
     * @param guardianFlag
     */
    void updateEnableFlagByRuleId(@Param("ruleId") Integer ruleId,
                                  @Param("enableFlag") Integer enableFlag,
                                  @Param("guardianFlag") Integer guardianFlag);

    /**
     * 逻辑删除
     *
     * @param ruleId
     */
    void deleteLogic(@Param("ruleId") Integer ruleId);

    /**
     * 查询启用分级推送的报警规则
     *
     * @param guardianFlag 分级推送标志
     * @return
     */
    List<AppEmpWarnRule> selectByGuardianFlag(@Param("guardianFlag") Integer guardianFlag);
}